//
//  NWSaleApplyRequest.m
//  KuWoCan
//
//  Created by hwd on 17/4/6.
//  Copyright © 2017年 hwd. All rights reserved.
//

#import "NWSaleApplyRequest.h"

@implementation NWSaleApplyRequest

//四个模块(除订单)的列表获取  以及删除  审核  这里只采用三个接口

- (void)startRequestGetAllApplyOrCheckListWithUserId:(NSString *)userId pageNo:(NSString *)pageNo pageSize:(NSString *)pageSize approvalStatus:(NSString *)approvalStatus approverUser:(NSString *)approverUser approvalType:(NSString *)approvalType moduleType:(NSInteger)moduleType
{
    _showError = YES;
    _showLoading = YES;
    self.isNotDataStr = YES;
     NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"user.id":userId,@"pageNo":pageNo,@"pageSize":pageSize,@"approvalType":approvalType,@"approverUser":approverUser}];
    switch (moduleType)
    {
        case HomeModuleTypeSA:
        {
            _path = NWSAQuery_Path;
            [dic setObject:approvalStatus forKey:@"statuslist"];
        }
            break;
        case HomeModuleTypeSC:
        {
            _path = NWSCQuery_Path;
            [dic setObject:approvalStatus forKey:@"statuslist"];
        }
            break;
        case HomeModuleTypePA:
        {
            _path = NWPAQuery_Path;
            [dic setObject:approvalStatus forKey:@"statuslist"];
        }
            break;
        case HomeModuleTypePC:
        {
            _path = NWPCQuery_Path;
            [dic setObject:approvalStatus forKey:@"statuslist"];
        }
            break;
        case HomeModuleTypeEA:
        {
            _path = NWEAQuery_Path;
            [dic setObject:approvalStatus forKey:@"statuslist"];
        }
            break;
        case HomeModuleTypeEC:
        {
            _path = NWECQuery_Path;
            [dic setObject:approvalStatus forKey:@"statuslist"];
        }
            break;
        case HomeModuleTypeOA:
        {
            _path = NWOAQuery_Path;
            [dic setObject:approvalStatus forKey:@"statuslist"];
        }
            break;
        case HomeModuleTypeOC:
        {
            _path = NWOCQuery_Path;
            [dic setObject:approvalStatus forKey:@"statuslist"];
        }
            break;
            
        default:
            break;
    }
    
    _params = dic;
    [self startPost];
}

- (void)startRequestDeleteApplyOrCheckWithId:(NSString *)Id moduleType:(NSInteger)moduleType
{
    _showError = YES;
    _showLoading = YES;
    BOOL isPost;
    switch (moduleType)
    {
        case HomeModuleTypeSA:
        {
            _path = NWSADelete_Path;
            isPost = NO;
        }
            break;
        
        case HomeModuleTypePA:
        {
            _path = NWPADelete_Path;
            isPost = NO;
        }
            break;
        case HomeModuleTypeEA:
        {
            _path = NWEADelete_Path;
            isPost = YES;
        }
            break;
        case HomeModuleTypeOA:
        {
            _path = NWOADelete_Path;
            isPost = YES;
        }
            break;
        default:
            isPost = NO;
            break;
    }

    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"id":Id}];
    
    _params = dic;
    if (isPost)
    {
        [self startPost];
    }
    else
    {
        [self startGet];
    }
    
}

- (void)startRequestPassApplyOrCheckWithId:(NSString *)Id userId:(NSString *)userId approvalStatus:(NSString *)approvalStatus approvalType:(NSString *)approvalType approvalMemo:(NSString *)approvalMemo moduleType:(NSInteger)moduleType MbContent:(NSString *)mbContent
{
    _showError = YES;
    _showLoading = YES;
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"id":Id,@"approvalType":approvalType}];
    switch (moduleType)
    {
        case HomeModuleTypeSA:
        {
            _path = NWSAPass_Path;
            [dic setObject:userId forKey:@"user.id"];
            [dic setObject:approvalStatus forKey:@"approvalStatus"];
            [dic setObject:approvalMemo forKey:@"approvalMemo"];
            [dic setObject:mbContent forKey:@"mbContent"];
        }
            break;
        case HomeModuleTypeSC:
        {
            _path = NWSCPass_Path;
            [dic setObject:userId forKey:@"user.id"];
            [dic setObject:approvalStatus forKey:@"examineStatus"];
            [dic setObject:approvalMemo forKey:@"approvalMemo"];
        }
            break;
        case HomeModuleTypePA:
        {
            _path = NWPAPass_Path;
            [dic setObject:userId forKey:@"user.id"];
            [dic setObject:Id forKey:@"id"];
            [dic setObject:approvalStatus forKey:@"approvalStatus"];
            [dic setObject:approvalMemo forKey:@"approvalMemo"];
            [dic setObject:mbContent forKey:@"mbContent"];
        }
            break;
        case HomeModuleTypePC:
        {
            _path = NWPCPass_Path;
            [dic setObject:userId forKey:@"user.id"];
            [dic setObject:approvalStatus forKey:@"examineStatus"];
            [dic setObject:approvalMemo forKey:@"approvalMemo"];
        }
            break;
        case HomeModuleTypeEA:
        {
            _path = NWEAPass_Path;
            [dic setObject:userId forKey:@"approverUser"];
            [dic setObject:approvalStatus forKey:@"approvalStatus"];
            [dic setObject:approvalMemo forKey:@"remarks"];
            [dic setObject:mbContent forKey:@"mbContent"];

        }
            break;
        case HomeModuleTypeEC:
        {
            _path = NWECPass_Path;
            [dic setObject:userId forKey:@"approverUser"];
            [dic setObject:approvalStatus forKey:@"examineStatus"];
            [dic setObject:approvalMemo forKey:@"remarks"];
//            [dic setObject:[Singleton shareInstance].userId forKey:@"user.id"];
        }
            break;
        case HomeModuleTypeOA:
        {
            _path = NWOAPass_Path;
            [dic setObject:Id forKey:@"id"];
            [dic setObject:userId forKey:@"approverUser"];
            [dic setObject:approvalStatus forKey:@"approvalStatus"];
            [dic setObject:approvalMemo forKey:@"remarks"];
             [dic setObject:mbContent forKey:@"mbContent"];
        }
            break;
        case HomeModuleTypeOC:
        {
            _path = NWOCPass_Path;
            [dic setObject:userId forKey:@"approverUser"];
            [dic setObject:approvalStatus forKey:@"examineStatus"];
            [dic setObject:approvalMemo forKey:@"remarks"];
        }
            break;
            
        default:
            break;
    }
    
    _params = dic;
    [self startPost];
}

//促销申请
- (void)startRequestCommitSaleApplyWithDic:(NSMutableDictionary *)dic
{
    _showError = YES;
    _showLoading = YES;
    _path = NWSACommit_Path;
    _params = dic;
    [self startPost];
}

- (void)startRequestUpdateSaleApplyWithDic:(NSMutableDictionary *)dic
{
    _showError = YES;
    _showLoading = YES;
    _path = NWSAUpdate_Path;
    _params = dic;
    [self startPost];
}

- (void)startRequestSaleApplyDetailWithId:(NSString *)Id
{
    _showError = YES;
    _showLoading = YES;
    _path = NWSADetail_Path;
    self.isNotDataStr = YES;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"id":Id}];
    
    _params = dic;
    [self startGet];
}


//促销核销

- (void)startRequestUpdateSaleCheckWithDic:(NSMutableDictionary *)dic
{
    _showError = YES;
    _showLoading = YES;
    _path = NWSCUpdate_Path;
    _params = dic;
    [self startPost];
}

- (void)startRequestSaleCheckDetailWithId:(NSString *)Id
{
    _showError = YES;
    _showLoading = YES;
    _path = NWSCDetail_Path;
    self.isNotDataStr = YES;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"id":Id}];
    
    _params = dic;
    [self startGet];
}


//产品陈列申请

- (void)startRequestCommitProductApplyWithDic:(NSMutableDictionary *)dic
{
    _showError = YES;
    _showLoading = YES;
    _path = NWPACommit_Path;  
    _params = dic;
    [self startPost];
}

- (void)startRequestUpdateProductApplyWithDic:(NSMutableDictionary *)dic
{
    _showError = YES;
    _showLoading = YES;
    _path = NWPAUpdate_Path;  
    _params = dic;
    [self startPost];
}

- (void)startRequestProductApplyDetailWithId:(NSString *)Id
{
    _showError = YES;
    _showLoading = YES;
    _path = NWPADetail_Path; 
    self.isNotDataStr = YES;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"id":Id}];
    
    _params = dic;
    [self startGet];
}


//产品陈列核销

- (void)startRequestUpdateProductCheckWithDic:(NSMutableDictionary *)dic
{
    _showError = YES;
    _showLoading = YES;
    _path = NWPCUpdate_Path;  
    _params = dic;
    [self startPost];
}

- (void)startRequestProductCheckDetailWithId:(NSString *)Id
{
    _showError = YES;
    _showLoading = YES;
    _path = NWPCDetail_Path;   
    self.isNotDataStr = YES;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"id":Id}];
    
    _params = dic;
    [self startGet];
}

/****  进场费用申请模块  ****/
- (void)startRequestCommitEnterApplyWithDic:(NSMutableDictionary *)dic
{
    _showError = YES;
    _showLoading = YES;
    _path = NWEACommit_Path;
    _params = dic;
    [self startPost];
}

- (void)startRequestUpdateEnterApplyWithDic:(NSMutableDictionary *)dic
{
    _showError = YES;
    _showLoading = YES;
    _path = NWEAUpdate_Path;
    _params = dic;
    [self startPost];
}

- (void)startRequestEnterApplyDetailWithId:(NSString *)Id
{
    _showError = YES;
    _showLoading = YES;
    _path = NWEADetail_Path;
    self.isNotDataStr = YES;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"id":Id}];
    
    _params = dic;
    [self startPost];
}


/****  进场费用核销模块  ****/

- (void)startRequestUpdateEnterCheckWithDic:(NSMutableDictionary *)dic
{
    _showError = YES;
    _showLoading = YES;
    _path = NWECUpdate_Path;
    _params = dic;
    [self startPost];
}

- (void)startRequestEnterCheckDetailWithId:(NSString *)Id
{
    _showError = YES;
    _showLoading = YES;
    _path = NWECDetail_Path;
    self.isNotDataStr = YES;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"id":Id}];
    
    _params = dic;
    [self startPost];
}

/****  其他费用申请模块  ****/
- (void)startRequestCommitOtherApplyWithDic:(NSMutableDictionary *)dic
{
    _showError = YES;
    _showLoading = YES;
    _path = NWOACommit_Path;
    _params = dic;
    [self startPost];
}

- (void)startRequestUpdateOtherApplyWithDic:(NSMutableDictionary *)dic
{
    _showError = YES;
    _showLoading = YES;
    _path = NWOAUpdate_Path;
    _params = dic;
    [self startPost];
}

- (void)startRequestOtherApplyDetailWithId:(NSString *)Id
{
    _showError = YES;
    _showLoading = YES;
    _path = NWOADetail_Path;
    self.isNotDataStr = YES;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"id":Id}];
    
    _params = dic;
    [self startPost];
}


/****  其他费用核销模块  ****/

- (void)startRequestUpdateOtherCheckWithDic:(NSMutableDictionary *)dic
{
    _showError = YES;
    _showLoading = YES;
    _path = NWOCUpdate_Path;
    _params = dic;
    [self startPost];
}

- (void)startRequestOtherCheckDetailWithId:(NSString *)Id
{
    _showError = YES;
    _showLoading = YES;
    _path = NWOCDetail_Path;
    self.isNotDataStr = YES;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"id":Id}];
    
    _params = dic;
    [self startPost];
}






@end
